package com.fowo.api.common.validator;

import com.fowo.api.common.util.SheetUtils;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import java.util.Date;

/**
 * 提供布尔类型的日期校验
 */
public class BooleanStringValidator implements ConstraintValidator<BooleanString, String> {

    @Override
    public boolean isValid(String value, ConstraintValidatorContext context) {
        try {
            SheetUtils.toBoolean(value);
        } catch (Exception e) {
            return false;
        }
        return true;
    }
}
